﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<ComeSeeThis_MVC2.Models.VehicleTypesFormView>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
    <%:Model.VehicleType.VehicleTypeName %>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <% Html.RenderPartial("SubMenu"); %>
    <h2>
        Vehicle Type Details
    </h2>
    <fieldset>
        <legend>
            <%:Model.VehicleType.VehicleTypeName %></legend>
        <table>
            <tr>
                <th>
                    Details
                </th>
                <th>
                    Vehicles
                </th>
            </tr>
            <tr>
                <td>
                    <table>
                        <tr>
                            <th>
                                Scale
                            </th>
                            <td>
                                1/<%:Model.VehicleType.Scale%>
                            </td>
                        </tr>
                        <tr>
                            <th>
                                VehicleTypeName
                            </th>
                            <td>
                                <%:Model.VehicleType.VehicleTypeName%>
                            </td>
                        </tr>
                    </table>
                </td>
                <td valign="top">
                    <%
                        
                        foreach (var vehicle in Model.Vehicles)
                        { %>
                    <a href="/Vehicle/Details/<%:vehicle.VehicleId %>">
                        <%: vehicle.Company.CompanyName %>
                        <%: vehicle.VehicleName %></a><br />
                    <% } %>
                </td>
            </tr>
        </table>
    </fieldset>
    <p>
        <%
            if (Model.VehicleType.WasSubmittedBy(User.Identity.Name) || User.IsInRole("SiteAdmin"))
            {
        %>
        <%:Html.ActionLink("Edit", "Edit", new {id = Model.VehicleType.VehicleTypeId})%>
        <%
            }
        %>
    </p>
</asp:Content>
